@extends('layouts.master')

@section('title')
   订单管理——钢链网管理后台
@stop

@section('app_css')
    <link rel="stylesheet" href="/resource/css/bootstrap.min.css">
    <link rel="stylesheet" href="/resource/css/font-awesome.min.css">
    <link rel="stylesheet" href="/resource/css/animate.min.css">
    <link rel="stylesheet" href="/resource/css/custom.css">
    <link rel="stylesheet" href="/resource/css/green.css">
    @stop

@section('app_js')
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="/resource/js/jquery.min.js"></script>
    <script src="/resource/js/bootstrap.min.js"></script>
    <script src="/resource/js/custom.js"></script>
    <!-- icheck -->
    <script src="/resource/js/icheck.min.js"></script>
    <!-- Datatables -->
    <script src="/resource/js/jquery.dataTables.js"></script>
    <script src="/resource/js/J_main.js"></script>
    <script src="/resource/js/T.js"></script>
    <script type="text/javascript">
        $(document).delegate('.delete','click',function(){
            var data = $(this).data();
            T.restPost('/admin/forest_delete',data,function(response){
                //console.log(response);
                if(response.data.state){
                    T.ajaxLoad('/admin/forest_service_ajax','list',function(){});
                }else{
                    alert("刪除失敗");
                }
            });
        });
        //锁定
        $(document).delegate('.lock','click',function(){
            var info = $(this).attr('rel');
            var ajax_order_id = $(this).attr('orderid');
            if(info == '20'){
                $(this).attr('rel','10').html('取消锁货').parent().siblings('.td_info').html('未支付(已锁货)');
            }else{
                $(this).attr('rel','20').html('锁货').parent().siblings('.td_info').html('已下单(未锁货)');
            };
            $.ajax({
                url : '/admin/order_status_ajax',
                type : "POST",
                data : {order_id:ajax_order_id,order_status:info},
                dataType : "json",
                async:'false',
                timeout:30000,
                success : function(json) {

                }
            });
        });

    </script>
@stop


@section('content')
    <body class="nav-md">
    <div class="container body">
        <div class="main_container">

            @include('common.admin_menu')

                    <!-- top navigation -->
            @include('common.admin_nav')
                    <!-- /top navigation -->


            <!-- page content -->
            <div class="right_col" role="main">

                <div class="">

                    <div class="row cont">

                        <div class="col-md-12 col-sm-12 col-xs-12">
                            <div class="x_panel">
                                <div class="x_title">
                                    <h2>订单管理 <small>订单列表</small></h2>
                                    <div class="clearfix"></div>
                                </div>
                                <div class="x_content" id="list">
                                    <table id="example" class="table table-striped responsive-utilities jambo_table">
                                        <thead>
                                        <tr class="headings">
                                            <th>
                                                <input type="checkbox" class="tableflat">
                                            </th>
                                            <th>订单号</th>
                                            <th>买家</th>
                                            <th >下单时间</th>
                                            <th>订单总额</th>
                                            <th>支付方式</th>
                                            <th>订单状态</th>
                                            <th class=" no-link last"><span class="nobr">操作</span>
                                            </th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        @foreach($info as $k => $v)
                                            <tr class="even pointer img-box">
                                                <td class="a-center ">
                                                    <input type="checkbox" class="tableflat">
                                                </td>
                                                <td class="tr-time">
                                                    {{ $v->order_sn }}
                                                </td>
                                                <td class="">{{$v->user_name}}</td>
                                                <td class="">{{date("Y-m-d H:i:s", $v->order_time)}}</td>
                                                <td class="">{{$v->amount}}</td>
                                                <td class="">
                                                    @if($v->payment_id==0)京东支付
                                                    @elseif($v->payment_id==1)现金
                                                    @elseif($v->payment_id==2)银行汇款
                                                    @elseif($v->payment_id==3)银行承兑汇票
                                                    @else其他@endif</td>
                                                <td class="td_info">
                                                    @if($v->order_status==10)已下单(未锁货)
                                                    @elseif($v->order_status==20)未支付(已锁货)
                                                    @elseif($v->order_status==30)已支付(待提货)
                                                    @elseif($v->order_status==40)已提货(代开票)
                                                    @elseif($v->order_status==50)已开发票(交易成功)
                                                    @elseif($v->order_status==60)已取消(交易失败)
                                                        @else已删除
                                                    @endif
                                                </td>
                                                
                                                <td class=" last">
                                                    <a href="/admin/order_details?order_id={{$v->order_id}}">查看编辑</a>
                                                    @if($v->order_status == 10 )
                                                        <a class="lock" href="javascript:;" rel="20" orderid="{{$v->order_id}}">锁货</a>
                                                    @elseif($v->order_status == 20 )
                                                        <a class="lock" href="javascript:;" rel="10" orderid="{{$v->order_id}}">取消锁货</a>
                                                    @else
                                                    @endif
                                                    <a href="/admin/order_pay_add?order_id={{$v->order_id}}">添加收款记录</a>


                                                </td>

                                            </tr>
                                        @endforeach
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <br />
                        <br />
                        <br />

                    </div>
                </div>

                <!-- footer content -->

                <footer>
                    <div class="">
                        <p class="pull-right">Copyright 2016 ganglianw.com All rights reserved. |
                            <span class="lead"> <i class="fa fa-logo-footer"></i> 钢链网后台管理系统</span>
                        </p>
                    </div>
                    <div class="clearfix"></div>
                </footer>
                <!-- /footer content -->
            </div>
            <!-- /page content -->

        </div>
    </div>

    <div id="custom_notifications" class="custom-notifications dsp_none">
        <ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group">
        </ul>
        <div class="clearfix"></div>
        <div id="notif-group" class="tabbed_notifications"></div>
    </div>
    </body>
@stop